package com.lee.transactionaldemo.service.nested;

import com.lee.transactionaldemo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author ：liylw
 * @date ：Created in 2021/4/23 16:22
 */
@Service
public class Nested2 {

    @Autowired
    private UserService userService;


    @Transactional(propagation = Propagation.NESTED, rollbackFor = Exception.class)
    public void testSuccess() {
        userService.saveUserBSuccess();
    }


    @Transactional(propagation = Propagation.NESTED, rollbackFor = Exception.class)
    public void testFail() {
        userService.saveUserBFail();
    }


}
